Ext.define('Fxt.cpct-sub-account.Controller', {
    extend: 'Fxt.core.CrudController',
    stores: 'Fxt.cpct-sub-account.Store',
    models: ['Fxt.cpct-sub-account.Model'],
    views: ['Fxt.cpct-sub-account.view.Viewport', 'Fxt.cpct-sub-account.view.Grid', 'Fxt.cpct-sub-account.view.QueryForm'],
    $onInit: function() {
        var me = this;
        var queryForm = me.$getViewport().$getQueryForm();
        var grid = me.$getViewport().$getGrid();
        var module = me.$getModule();
        this.control({
            'button[action=auth-id]': {
                click: function(btn) {
                    var grid = me.$getViewport().$getGrid();
                    Fxt.selectOneRow(grid, function(record) {
                        var mobile = record.get("mobile");
                        Fxt.ajax({
                            method: 'POST',
                            url: '/cpct-account/auth-id',
                            params: {
                                mobile: mobile
                            },
                            success: function (data) {
                                Fxt.success('已提交实名认证');
                            }
                        });
                    });
                }
            }
        });
    }
});